package com.example.goodrubish.Garbage;
// Question.java


/**
 * 保存数据库数据
 * Created by LGL on 2016/6/4.
 */
import android.os.Parcel;
import android.os.Parcelable;

public class Question implements Parcelable {
    public int ID;
    public String question;
    public String answerA;
    public String answerB;
    public String answerC;
    public String answerD;
    public int answer;
    private int selectedAnswer = -1;
    public String explaination;

    // 构造函数
    public Question() {
        // 空构造函数，用于序列化
    }
  // 用户选择的答案索引

    public int getAnswer() {
        return answer;
    }

    public void setAnswer(int answer) {
        this.answer = answer;
    }

    public int getSelectedAnswer() {
        return selectedAnswer;
    }

    public void setSelectedAnswer(int selectedAnswer) {
        this.selectedAnswer = selectedAnswer;
    }


    // 读取对象
    protected Question(Parcel in) {
        ID = in.readInt();
        question = in.readString();
        answerA = in.readString();
        answerB = in.readString();
        answerC = in.readString();
        answerD = in.readString();
        answer = in.readInt();
        explaination = in.readString();
    }

    public static final Creator<Question> CREATOR = new Creator<Question>() {
        @Override
        public Question createFromParcel(Parcel in) {
            return new Question(in);
        }

        @Override
        public Question[] newArray(int size) {
            return new Question[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(ID);
        dest.writeString(question);
        dest.writeString(answerA);
        dest.writeString(answerB);
        dest.writeString(answerC);
        dest.writeString(answerD);
        dest.writeInt(answer);
        dest.writeString(explaination);
    }
}